﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_DXC : System.Web.UI.Page
{
    private string num = "";
    private int good = 0;
    private int wcs = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
        num = Request.QueryString["Num"];
        DataSet ds = BLLFactory.CreateWorkBLL().Select(num);
        if (ds == null)
            Response.Write(" <script   language=javascript> window.alert( '无此记录，请联系管理员！ ');</script> ");
        else
        {
            txtNum.Text = num;
            txtNum.Attributes["contentEditable"] = "false";
            txtKu.Text = ds.Tables[0].Rows[0]["ku"].ToString();
            txtKu.Attributes["contentEditable"] = "false";
            txtNeirong.Text = ds.Tables[0].Rows[0]["neirong"].ToString();
            txtNeirong.Attributes["contentEditable"] = "false";
            good = Convert.ToInt32(ds.Tables[0].Rows[0]["good"].ToString());
            wcs = Convert.ToInt32(ds.Tables[0].Rows[0]["wcs"].ToString());
            int cs = good - wcs;
            txtCS.Text = cs.ToString();
            txtCS.Attributes["contentEditable"] = "false";

        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        DxcInfo dx = new DxcInfo();
        dx.Num = txtNum.Text.ToString();
        dx.Ku = txtKu.Text.ToString();
        dx.Jbanzu = Session["用户信息.班组"].ToString();
        dx.Jday = DateTime.Now.ToString();
        dx.Neirong = txtNeirong.Text.ToString();
        dx.Cs = Convert.ToInt32(txtCS.Text.ToString());
        dx.Dun = Convert.ToDecimal(txtDun.Text.ToString());
        checkValue = BLLFactory.CreateDxcBLL().Add(dx);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        Response.Redirect("DXCJL.aspx");
    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        txtDun.Text = "";
    }
}
